package com.jajahome.feature;

import android.content.Intent;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;

import com.jajahome.R;
import com.jajahome.base.BaseActivity;
import com.jajahome.feature.home.MainAty;
import com.jajahome.util.CountDownTimer;

import butterknife.BindView;

/**
 * Created by Administrator on 2017/4/13.
 */
public class AnimAct extends BaseActivity {


    @BindView(R.id.btn_skip)
    Button btn;
    @BindView(R.id.img)
    ImageView img;
    private CountDownTimer mc;

    @Override
    protected int getViewId() {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        return R.layout.act_anim_lunch;
    }

    @Override
    protected void initEvent() {


        if (LaunchAct.bitmap != null) {
            img.setImageBitmap(LaunchAct.bitmap);
        }

        mc = new CountDownTimer(4000, 1000) {
            public void onTick(long millisUntilFinished) {
                btn.setText(millisUntilFinished / 1000 + "秒跳转");
                btn.setTextSize(12);
            }

            public void onFinish() {
                Intent intent = new Intent(AnimAct.this, MainAty.class);
                startActivity(intent);
                finish();
            }
        }.start();


        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mc.cancel();
                Intent intent = new Intent(AnimAct.this, MainAty.class);
                startActivity(intent);
                finish();
            }
        });
    }

}



